<?php

namespace app\coupons\controller;

use library\Controller;
use think\Db;


/** 积分特权
 * Created by PhpStorm.
 * User: ycp
 * Date: 2019/11/18
 * Time: 21:07
 */

class ScorePrivilege extends Controller
{
    protected $table = 'lite_score_privilege';

    //积分特权首页
    public function index()
    {
        $this->title = '积分特权管理';
        $where = ['is_deleted' => 0];
        $this->_query($this->table)->like('name')->where($where)->order('id', 'desc')->page();
    }


    //添加积分特权
    public function add()
    {
        $this->title = '添加积分特权';
        $this->isAddMode = '1';
        $this->applyCsrfToken();
        return $this->_form($this->table, 'form');
    }

    public function edit()
    {
        $this->title = '编辑积分特权';
        $this->isAddMode = '0';
        $this->applyCsrfToken();
        return $this->_form($this->table, 'form');
    }

    public function del()
    {
        $this->applyCsrfToken();
        $this->_delete($this->table);
    }


    public function _form_filter(&$data)
    {
        if ($this->request->isGet()) {

        } elseif ($this->request->isPost()) {
            $data['create_time'] = date('Y-m-d H:i:s');

        }
    }

}